#include "SumNode.h"
#include <qobject.h>

SumNode::SumNode()
    :m_in1(new AbsIoNode(this, AbsIoNode::input))
    ,m_in2(new AbsIoNode(this, AbsIoNode::input))
    ,m_out(new AbsIoNode(this, AbsIoNode::output))
{
    registerIoNode("input", m_in1);
    registerIoNode("input2", m_in2);
    registerIoNode("output", m_out);
}

SumNode::~SumNode()
{
}

bool SumNode::run()
{
    qreal& in1 = (m_in1->variable());
    qreal& in2 = (m_in2->variable());
    qreal& out = (m_out->variable());
    out = in1 + in2;
    return true;
}

QString SumNode::lastErrorMsg()
{
    return QString();
}

QString SumNode::displayText()
{
    return nodeName();
}

QVariantMap SumNode::getParams()
{
    return QVariantMap();
}

void SumNode::setParams(QVariantMap paramsMap) { 
    Q_UNUSED(paramsMap)
}

QString SumNode::nodeName()
{
    return QObject::tr("Sum");
}
